<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第一天</title>
</head>

<body>
    <script>
        Array.prototype.Mymap = function (callback) {
            this.sort(function (a, b) {
                return a - b
            })
            this.splice(0, 1)
            this.splice(this.length - 1, 1)
            for (let i = 0; i < this.length; i++) {
                callback(this[i], i, this)
            }
            // console.log(callback());
        }
        let arr = [12, 45, 3, 78, 4, 56, 23, 24]
        let sum = 0
        let pin = 0
        arr.Mymap(function callback(item, index, Array) {
            // console.log(item)
            sum += item
            pin = sum / Array.length
        })
        console.log(pin)
    </script>
</body>

</html>